#include "Headers.h"
#include "Camera.h"


CCamera::CCamera(void)
{
	m_object = NULL;
}


CCamera::~CCamera(void)
{
	m_object = NULL;
}

bool CCamera::Initiallize(void)
{
	m_isfree = true;
	m_x = 0;
	m_y = 0;
	SetRect(&m_rcCamera, 0, 0, 1024, 768);
	return true;
}

void CCamera::Process(void)
{
	if( m_isfree == false )
	{
		if( m_object != NULL )
		{
			m_x = m_object->GetX();
			m_y = m_object->GetY();
		}
		else
		{
			return ;
		}
	}

	m_CenterX = m_x;
	m_CenterY = m_y;

	m_CenterX -= (WINDOW_WIDTH/2);
	m_CenterY -= (WINDOW_HEIGHT/2);

	SetRect(&m_rcCamera, m_CenterX, m_CenterY, m_CenterX+WINDOW_WIDTH, m_CenterY+WINDOW_HEIGHT );
}